package com.code2roc.jarmanage.db;

import com.code2roc.jarmanage.model.CommandDO;
import com.code2roc.jarmanage.util.CommonUtil;
import com.code2roc.jarmanage.util.DataBaseUtil;

import java.util.List;

public class CommandDB {
    public static void insert(CommandDO entity) {
        entity.setCommandID(CommonUtil.getNewGuid());
        DataBaseUtil.insert("ExecuteCommand", entity);
    }

    public static void delete(String commandID) {
        DataBaseUtil.executeSQL("delete from ExecuteCommand where commandID='" + commandID + "'");
    }

    public static void update(CommandDO entity) {
        DataBaseUtil.update("ExecuteCommand", entity, "commandID");
    }

    public static CommandDO selectOne(String commandID) {
        return DataBaseUtil.selectOne(CommandDO.class, "ExecuteCommand", "commandID", commandID);
    }

    public static List<CommandDO> selectList(String where) {
        return DataBaseUtil.selectList(CommandDO.class, "ExecuteCommand", where);
    }
}
